Skip to content

edit middleware#2

Open
great-park wants to merge 1 commit intohonglytech:mainfrom
great-park:main
Open

edit middleware#2
great-park wants to merge 1 commit intohonglytech:mainfrom
great-park:main

Conversation

@great-park
Copy link

If I send request without access-token, then server crash with "Cannot set headers after they are sent to the client" error.
I think that's because the application set header twice when we send request without access-token.
So, it can be solved by appliying if-else statement

// Authenticate token
try {
const user = await jwt.verify(token, process.env.ACCESS_TOKEN_SECRET);
req.user = user.email;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we saving the user emails too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants